# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=xxkb
pkgver=1.11.1
pkgrel=3
pkgdesc="keyboard layout switcher/indicator"
arch=('loong64' 'x86_64')
url="https://sourceforge.net/projects/xxkb/"
license=('PerlArtistic')
depends=('libxpm')
makedepends=('imake')
source=("https://downloads.sourceforge.net/${pkgname}/${pkgname}-$pkgver-src.tar.gz"
    	XXkb
    	en22.xpm
    	ru22.xpm)
sha256sums=('ceaa33bed81d8ae5bf77e89787d0736f7564c3de047c35a57bcbf6f4d1888142'
            'fa997405160d8dd1383cc8705679553d1bcf8b20e343995da31250230d7ed39b'
            'c271205439821c5be32eeb15834703e7c57143bab8be83f148787677f1642924'
            'f6c4c87e1964d889d8144b2d2c9d12cfa5907a82efc24808903fca2202ae7be8')

build() {
  cd "${srcdir}"/${pkgname}-${pkgver}
  xmkmf
  make PROJECTROOT=/usr PIXMAPDIR=/usr/share/$pkgname LOCAL_LIBRARIES='-lXext -lXt -lXpm -lX11'
}

package() {
  cd "${srcdir}"/${pkgname}-${pkgver}
  install -d "$pkgdir"/usr/bin
  install -d "$pkgdir"/usr/share/$pkgname
  install -d "$pkgdir"/usr/man/man1
  install -d "$pkgdir"/usr/share/X11/app-defaults

  install -m 0755 xxkb "$pkgdir"/usr/bin
  install -m 0644 ../XXkb "$pkgdir"/usr/share/X11/app-defaults/XXkb
  install -m 0644 pixmaps/*.xpm "$pkgdir"/usr/share/$pkgname
  install -m 0644 $pkgname.man "$pkgdir"/usr/man/man1/$pkgname.1
  install -m 0644 ../*.xpm "$pkgdir"/usr/share/$pkgname/

  mv "$pkgdir"/usr/man "$pkgdir"/usr/share/
}
